#import "ToolbarSearchView.h"


@implementation ToolbarSearchView

- (id)initWithFrame:(NSRect)frameRect
{
	if ((self = [super initWithFrame:frameRect]) != nil) {
		recentSearches = [[NSMutableArray alloc] init];
	}
	return self;
}

- (void)dealloc {
	[recentSearches release];
	[super dealloc];
}

- (IBAction)go:(id)sender
{
	NSString *str = [nibTextToolbar stringValue];
	if(str && [str length]>0) {
		[nibTextSearchView setStringValue:str];
		[nibViewSearch startNetworkSearch:self];
		[recentSearches addObject:str];
		[(NSSearchField *)nibTextSearchView setRecentSearches:recentSearches];
	}
	[nibTextToolbar setStringValue:@""];
}

@end
